package com.epam.epamtest.config;

import cn.hutool.cache.impl.TimedCache;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUnit;
import com.google.common.util.concurrent.RateLimiter;

import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class Constants {

    public final static String[] PARAM_NAME = {"省级", "市级", "区级"};

    public final static Set<String> MUNICIPALITY_SET = CollUtil.set(false, "北京", "上海", "天津", "重庆");

    public final static String STATUS = "status";

    public final static TimedCache<String, Object> TIMED_CACHE = new TimedCache(5 * DateUnit.MINUTE.getMillis(), new ConcurrentHashMap());

    //错误码
    public final static int ERROR_CODE = 100;

    public final static String ERROR_MSG_TEMPLATE = "{} must have text; it must not be null, empty, or blank";

    public final static int TIMEOUT = (int) (2 * DateUnit.SECOND.getMillis());

    //重试次数
    public final static int MAX_ATTEMPTS = 3;

    //每秒限流数
    public final static int PERMITS_PER_SECOND = 100;

    //限流器
    public final static RateLimiter RATE_LIMITER = RateLimiter.create(PERMITS_PER_SECOND);

}
